<?php require_once("classes.php");
ob_start();
	$name 		= $_POST['name'];
	$username 	= $_POST['user'];
	$password 	= $_POST['pass'];
	$email 		= $_POST['mail'];
	
	$password 	= md5($password);
	
	$name	 	= mysql_real_escape_string($name);
	$username	= mysql_real_escape_string($username);
	$email	 	= mysql_real_escape_string($email);
	$name		= stripslashes($name);
	$username 	= stripslashes($username);
	$email	 	= stripslashes($email);

	$usuario = new User();
	$usuario->set_username($username);
	$usuario->set_name($name);
	$usuario->set_password($password);
	$usuario->set_email($email);
	if($usuario->verificar_email()){
		$usuario->new_user();
		$usuario->logar($_POST['user'],$password);
	}else{
		echo("E-Mail inválido.");
	}
	header("location:/home/p/home");

?>